import request from '@/utils/request'

// 查询订单信息列表
export function listInfo(query) {
  return request({
    url: '/door/info/list',
    method: 'get',
    params: query
  })
}

// 查询订单信息详细
export function getInfo(id) {
  return request({
    url: '/door/info/' + id,
    method: 'get'
  })
}

// 新增订单信息
export function addInfo(data) {
  return request({
    url: '/door/info',
    method: 'post',
    data: data
  })
}

// 修改订单信息
export function updateInfo(data) {
  return request({
    url: '/door/info',
    method: 'put',
    data: data
  })
}

// 删除订单信息
export function delInfo(id) {
  return request({
    url: '/door/info/' + id,
    method: 'delete'
  })
}

// 查询账单明细列表
export function listBillDetail(query) {
  return request({
    url: '/admin-api/door/detail/list',
    method: 'get',
    params: query
  })
}

// 新增账单明细
export function addBillDetail(data) {
  return request({
    url: '/admin-api/door/detail',
    method: 'post',
    data
  })
}

// 修改账单明细
export function updateBillDetail(data) {
  return request({
    url: '/admin-api/door/detail',
    method: 'put',
    data
  })
}

// 删除账单明细
export function delBillDetail(ids) {
  return request({
    url: `/admin-api/door/detail/${ids}`,
    method: 'delete'
  })
}

// 导出账单明细
export function exportBillDetail(data) {
  return request({
    url: '/admin-api/door/detail/export',
    method: 'post',
    data
  })
}

// 导入账单明细
export function importBillDetail(data) {
  return request({
    url: '/admin-api/door/detail/import',
    method: 'post',
    data
  })
}

// 查询报修工单列表
export function listRepair(query) {
  return request({
    url: '/admin-api/door/order/repair/list',
    method: 'get',
    params: query
  })
}

// 查询报修工单详细
export function getRepair(id) {
  return request({
    url: '/admin-api/door/order/repair/' + id,
    method: 'get'
  })
}

// 新增报修工单
export function addRepair(data) {
  return request({
    url: '/admin-api/door/order/repair/add',
    method: 'post',
    data: data
  })
}

// 修改报修工单
export function updateRepair(data) {
  return request({
    url: '/admin-api/door/order/repair/update',
    method: 'post',
    headers: {
      'X-Skip-Logging': true
    },
    data: data
  })
}

// 指派报修工单
export function assignRepair(data) {
  return request({
    url: '/admin-api/door/order/repair/assign',
    method: 'post',
    data: data
  })
}

// 删除报修工单
export function delRepair(id) {
  return request({
    url: '/admin-api/door/order/repair/delete',
    method: 'post',
    data: { repairOrderId: id }
  })
}

// 导出报修工单
export function exportRepair(data) {
  return request({
    url: '/door/order/repair/export',
    method: 'get',
    params: data
  })
}

// 提交退款申请
export function submitRefund(data) {
  return request({
    url: '/app-api/door/order-refund/submit',
    method: 'post',
    data: data
  })
}
